package com.yellowcong.controller;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;

import com.yellowcong.shiro.utils.ControllerUtils;


@Controller
@RequestMapping("/file")
public class FileController {
	
	@RequestMapping(value="/upload",method=RequestMethod.POST)
	public void upload(HttpServletResponse response ,MultipartFile file) {
		
		try {
			InputStream in = file.getInputStream();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("result", true);
		ControllerUtils.writeJSON(response, map);
	}
}
